package presenters.component

class BlogLayoutComponent {

    def namespace = "blogLayout"

    def head = { decorated ->
        builder.head {
            decorated("Groovy Publish - ")
            link(rel:"stylesheet", href:"/groovypublish/css/screen.css") {}
        }
    }

    def body = { tags, blogConfig, decorated ->
        builder.body {
            div(id:"authlinks") {
                gp.authenticated {
                    gp.anchor(controller:"user", action:"logout") {"logout"}
                }
                gp.notAuthenticated {
                    gp.anchor(controller:"user", action:"login") {"login"}
                }
            }
            div(id:"outer") {
                div(id:"header") {
                    h1 {
                        gp.anchor(controller:"post", action:"list") {blogConfig.title}
                    }
                    p(blogConfig.description)
                }
                div(id:"container") {
                    div(id:"main") {
                        decorated()
                    }
                    div(id:"rightnav") {
                        h2("Tags")
                        gp.tagsAsLinks(tags)
                    }
                }
                div(id:"footer") {
                    p {
                        span("Subscribe to "){}
                        gp.anchor(controller:"post", action:"rss") {"rss"}
                    }
                }
            }
        }
    }
}